package org.mall.modules.order.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.mall.common.api.vo.CommonResult;
import org.mall.common.util.ObjectUtils;
import org.mall.modules.order.entity.OrderCredential;
import org.mall.modules.order.mapper.OrderCredentialMapper;
import org.mall.modules.order.service.OrderCredentialService;
import org.mall.modules.pojo.order.dto.OrderCredentialDetailDTO;

import javax.annotation.Resource;
import java.util.List;

/***
 *@author yinxucun
 *@date 2019-12-26 18:13 
 */
@org.springframework.stereotype.Service
@Slf4j
public class OrderCredentialServiceImpl implements OrderCredentialService {

    @Resource
    private OrderCredentialMapper orderCredentialMapper;


    @Override
    public CommonResult<List<OrderCredentialDetailDTO>> getOrderCredentialListBySellerIdAndDateRange(String userId, String startTim, String endTime){
        log.info("date"+startTim+"date"+endTime);
        List<OrderCredential> list=orderCredentialMapper.getOrderCredentialListBuSellerId(userId,startTim,endTime);

        List<OrderCredentialDetailDTO> temp= ObjectUtils.copyList(list,OrderCredentialDetailDTO.class);

        if (list.isEmpty()){
            return CommonResult.error("");
        }
        return CommonResult.success(temp);

    }
}
